<template>
	<!-- 首页加载全屏动画 -->
	<full-loading v-if="loading" />
	<div class="w-full h-full relative gb-container">
		<nuxt-loading-indicator class="relative absolute top-1/2 left-1/2" :duration="2000" :throttle="0">
			<full-loading />
		</nuxt-loading-indicator>
		<nav-bar id="gb-header" />
		<client-only> <nuxt-page /> <footer-bar /> </client-only>

		<a-back-top>
			<a-button shape="circle" type="primary" size="large"> <icon-to-top :size="28" /> </a-button>
		</a-back-top>
	</div>
</template>
<script setup lang="ts">
const nuxtApp = useNuxtApp();
const { loading } = useFullLoading(nuxtApp);
// 防抖
onMounted(async () => {
	await nextTick();
	useDeviceType();
	const throttledUseDeviceType = debounce(useDeviceType, 200);
	window.onresize = throttledUseDeviceType;
	useHeaderRoom(document.querySelector("#gb-header")!);
});
// 组件卸载时清除事件监听器
onUnmounted(() => {
	window.onresize = null;
});
</script>
<style lang="less"></style>
